<div>
<ul id="resources_tree"></ul>
</div>
<script type="text/javascript">
$('#resources_tree').tree({
	method: 'get',
	lines:true,
	checkbox:true,
	width:200,
    url: JSmile.baseUrl+'/sys_resources/findAll',
    loadFilter:function(data,parent){
    	return JSmile.convert(data);
    },
    onLoadSuccess:function(node, data){
    	var _roleId='${roleId}';
    	var resources_tree=$("#resources_tree"); 
    	resources_tree.tree("clearAllChecked");
       	JSmile.KHttp.send({
       		url:"/sys_role/getRoleResources",
    	    data:{roleId:_roleId}}).done(function(res){
    			for(var i=0;i<res.resData.rows.length;i++){
    				var node = resources_tree.tree('find', res.resData.rows[i].id);
    				resources_tree.tree('check', node.target);
    			}
       	});
    }
});
</script>